


<script>

$(document).ready(function(){
    $("input[name=optionAnomalia]").change(function() {
        var test = $(this).val();
        if(test){
            $(".refN").show('slow');
            $(".p").show('slow');
        } else {
        	$(".refN").hide();
        	$(".p").hide();
        }
    }); 
});

function generatePraticaCod(){
	var myRadio = $('input[name=optionAnomalia]');
	var checkedValue = myRadio.filter(':checked').val();
	var intId = ${params.interviewId};
	var refName = $('#refName').val();
	
	${remoteFunction(
			asynchronous: false,
			action:'generateAnomaliaAndPratica',
			controller:'interview',
			params: '\'anomalia=\' + checkedValue + \'&intId=\' + intId + \'&refName=\' + refName',
			onSuccess: 'showCodicePratica(data,textStatus);'			
	)}
}


function showCodicePratica(data,textStatus){
	$(".p").hide('slow');
	$('#praticaId').html('Pratica creata con codice per &nbsp&nbsp<b>' + data + '</b> &nbsp&nbsp caricare documenti accedi alla pratica');
	$('#goPratica').attr('href', '/Pratica/anomaliabancaria/'+data);		
	 $(".gotoPratica").show('slow');
}

function hideAll(){
	$(".gotoPratica").hide();
}

</script>

<div class="row">
	<div class="col-lg-12">
		<label class="col-sm-2 control-label"><h3></br>Tipologia:</h3></label>

		<g:each in="${com.macrosolution.exdebito.AnomaliaBancariaType?.list()}" var="a" status="i">
			<div class="col-sm-2">
				<div class="smart-form inline-group">
				</br></br>
					<label class="radio">
						<input type="radio" value="${a.anomaliaBancariaType}" name="optionAnomalia" 
								id="optionAnomalia" class="checkbox_anomalia" onChange="hideAll();">
						<i></i></i><h4><b>&nbsp&nbsp ${a.anomaliaBancariaType}</b></h4>
					</label>
				</div>
			</div>
		</g:each>
		
		</label>
	</div>
</div>

	<div class="refN" style="display:none">
		<div class="row">
			<div class="col-sm-4 col-md-offset-4" align="center">
				<div class="smart-form inline-group">
					<div class="input-group">
						<span class="input-group-addon"><i class="fa fa-info fa-lg fa-fw"></i></span>
						<input class="form-control input-md" placeholder="  Titolo di Riferimento  " type="text" name="refName" id="refName">
					</div>
				</div>
			</div>		
		</div>	
	</div>	
			
<div class="p" style="display:none">
	<div class="row">
		<div class="col-lg-12" align="center">
			<div class="form-group">
				</br>
				<input type="button" name="goPratica" class="btn btn-lg btn-primary" value=" Genera Pratica e Rapporto Bancario per Caricare i Documenti "		
					onClick="generatePraticaCod()"> 
				&nbsp;&nbsp;		
			</div>
		</div>
	</div>
</div>

<div class="gotoPratica" style="display:none">
	<div class="row">
		<div class="col-lg-11" align="center">
			<div class="form-group">
				</br>
				<h4 id="praticaId"></h4>
				</br></br>
				
				<a type="button" name="goPratica" id="goPratica" class="btn btn-lg btn-success">Accedi al Rapporto Bancario</a> 
				&nbsp;&nbsp;		
			</div>
		</div>
	</div>
</div>

</br></br>


